package com.ethan.modules.organization.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.ethan.common.orm.model.IDModel;

@Entity
@Table(name = "tz_wf_test_user")
public class User extends IDModel implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3357951448207171901L;
	private String loginName;
	private String userName;
	private String password;
	private int orderNo;
	private int isActive;		//账号是否被禁用 0：不可用 1：可用
	private Department dept;
	private String email;
	
	@Column(name = "email", length = 50)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "isActive", nullable = false)
	public int getIsActive() {
		return isActive;
	}

	public void setIsActive(int isActive) {
		this.isActive = isActive;
	}

	@Column(name = "orderNo")
	public int getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(int orderNo) {
		this.orderNo = orderNo;
	}

	@Column(name = "username", length = 30)
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	@Column(name = "loginname", length = 30, nullable = false, unique = true)
	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	@Column(name = "password", length = 20)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
    // cascade表示级联。CascadeType.REFRESH级联刷新   
    // optional表示该对象可有可无，它的值为true表示该外键可以为null，它的值为false表示该外键为not null   
    @ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, optional = true)   
    // JoinColumn表示外键的列   
    @JoinColumn(name="deptId")
	public Department getDept() {
		return dept;
	}

	public void setDept(Department dept) {
		this.dept = dept;
	}


}